package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.VssConstants;
import cn.com.sbell.vss.VssException;
import cn.com.sbell.vss.csg.vap.bean.UploadPic;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.BeanValidator;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

public class SetUploadPictureConfig extends ProtectedVsCommander{

	@Override
	protected Element executeCommand(VsClient vsClient,
			PropertiesHolder holder, Element root) {
		UploadPic u=(UploadPic)holder.populate(new UploadPic());
		BeanValidator.validateNotNull(u,new String[]{"uploadURL","enableUploadPicture",
				"limitedAmount","limitedResolution","waitingTimeAfterfailure"});
		if(!vsClient.setUploadPicture(u)){
			throw new VssException(VssConstants.CODE_VS_SET_UPLOAD_PICTURE);
		}
		return root;
	}

}
